Skip to content

[dynamic control] Add trace sampling validation#2604

Merged
trask merged 2 commits intoopen-telemetry:mainfrom
jackshirazi:policy2
Feb 9, 2026
Merged

[dynamic control] Add trace sampling validation#2604
trask merged 2 commits intoopen-telemetry:mainfrom
jackshirazi:policy2

Conversation

@jackshirazi
Copy link
Copy Markdown
Contributor

Initial implementation of trace sampling validation per #2546.

A full working implementation of the open-telemetry/opentelemetry-specification#4738 is here in this branch

@jackshirazi jackshirazi requested a review from a team as a code owner February 3, 2026 13:50
Copilot AI review requested due to automatic review settings February 3, 2026 13:50
@github-actions github-actions bot requested a review from LikeTheSalad February 3, 2026 13:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds initial support for trace sampling validation in the dynamic-control module, implementing validation for trace sampling policies according to OpenTelemetry specification pull request #4738.

Changes:

  • Introduces a PolicyValidator interface for validating telemetry policy configurations
  • Implements TraceSamplingValidator to validate trace sampling policies with probability values between 0.0 and 1.0
  • Supports both full JSON format and a simplified "trace-sampling.probability" alias for configuration

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
PolicyValidator.java Defines the interface for policy validators with JSON and alias validation methods
TraceSamplingValidator.java Implements trace sampling validation with probability range checking

} catch (JsonProcessingException e) {
// Not valid JSON for this validator
}
logger.info("Invalid trace-sampling JSON: " + json);
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the full JSON input at INFO level could expose sensitive data. Consider logging only a sanitized message or moving this to DEBUG level with appropriate sanitization.

Copilot uses AI. Check for mistakes.
} catch (NumberFormatException e) {
// invalid
}
logger.info("Ignoring invalid trace-sampling.probability value: " + value);
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the raw input value could expose sensitive data. Consider logging a generic message instead or sanitizing the value before logging.

Copilot uses AI. Check for mistakes.
…/policy/PolicyValidator.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jackshirazi jackshirazi changed the title Add trace sampling validation [dynamic control] Add trace sampling validation Feb 3, 2026
@trask trask added this pull request to the merge queue Feb 9, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 9, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Merged via the queue into open-telemetry:main with commit 5b5503f Feb 9, 2026
21 checks passed
@jackshirazi jackshirazi deleted the policy2 branch April 1, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants